const express=require('express')
const cors=require('cors')
const userRouter=require('./routes/user')
const friendRouter=require('./routes/friend')
const connect1Router=require('./routes/connect1')
const addfriendRouter=require('./routes/addfriend')
const app=express()
app.listen(3000,()=>{
	console.log('3000端口服务开启')
})
app.use(cors())
app.use(express.static('public'))
app.use(express.urlencoded({
	extended:true
}))

app.use('/user',userRouter)
app.use('/friend',friendRouter)
app.use('/connect1',connect1Router)
app.use('/addfriend',addfriendRouter)

app.use((err,req,res,next)=>{
	console.log(err)
	res.send({code:500,msg:'服务器端错误'})
})

